<?php
/**
 * 自定义模块
 */

namespace backend\controllers;

use common\utils\XCache;
use yii;
use common\models\Module;

class ModuleController extends CommonController
{
    public function actions()
    {
        return [
            'Kupload' => [
                'class' => 'pjkui\kindeditor\KindEditorAction'
            ]
        ];
    }

    public function actionIndex()
    {
        $this->setQuery(Module::find());
        return $this->query();
    }

    public function actionCreate()
    {
        $model = new Module();
        $this->setModel($model);
        return $this->save();
    }

    public function actionUpdate($id)
    {
        $model = Module::findOne($id);
        $this->setModel($model);
        return $this->save();
    }

    public function actionDelete()
    {
        $this->setModel(new Module());
        $this->delete();
    }

    public function savedHandle($model)
    {
        XCache::moduleDelete();
    }

    public function deletedHandle($id)
    {
        XCache::moduleDelete();
    }

}